{{ template "header" . }}

<!-- Breadcrumb -->
<ol class="breadcrumb">
  <li class="breadcrumb-item"><a href="/">Home</a></li>
  <li class="breadcrumb-item"><a href="{{ Url "virtual-machine-list" }}">Virtual Machines</a></li>
  <li class="breadcrumb-item"><a href="{{ Url "virtual-machine-list" }}?node={{ .Vm.NodeId }}">{{ .Vm.NodeId }}</a></li>
  <li class="breadcrumb-item"><a href="{{ Url "virtual-machine-detail" "id" .Vm.Id "node" .Vm.NodeId }}">{{ .Vm.Id }}</a></li>
  <li class="breadcrumb-item active">Update</li>
</ol>


<div class="container">
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <div class="card-body">
          <h4>Update Virtual Machine</h4>
          <br>

          <form class="JS-ReactiveForm" method="post" action="">{{ CSRFField .Request }}
            <div class="form-group row">
              <div class="col-md-2">
                <label>Cpu Count</label>
                <input required="required" value="{{ .Vm.VCpus }}" type="number" min="1" class="form-control" name="Vcpus"
                  id="Vcpus">
              </div>
              <div class="col-md-4">
                <label>Memory</label>
                <div class="input-group">
                  <input required="required" class="form-control" name="MemoryValue" min="1" id="MemoryValue" type="number" value="{{ .Vm.Memory.M }}">
                  <div class="input-group-append">
                    <select style="border-top-left-radius: 0; border-bottom-left-radius: 0;" name="MemoryUnit" class="custom-select">
                      <option value="B">B</option>
                      <option value="K">K</option>
                      <option value="M" selected>M</option>
                      <option value="G">G</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>

            <div class="form-group row">
              <div class="col-md-2">
                <label for="GraphicType">Graphic Type</label>
                <select required="required" class="custom-select" name="GraphicType" id="GraphicType">
                  {{ range .GraphicTypes }}
                  <option {{ if eq $.Vm.Graphic.Type . }}selected{{ end }} value="{{ .String }}">{{ .String | Capitalize }}</option>
                  {{ end }}
                </select>
              </div>
              <div class="col-md-2">
                <label for="VideoModel">Video Model</label>
                <select required="required" class="custom-select" name="VideoModel" id="VideoModel">
                  {{ range .VideoModels }}
                  <option {{ if eq $.Vm.VideoModel . }}selected{{ end }}  value="{{ .String }}">{{ .String | Capitalize }}</option>
                  {{ end }}
                </select>
              </div>
              <div class="col-md-2">
                <label for="GraphicListen">Graphic Listen Host</label>
                <input value="{{ .Vm.Graphic.Listen }}" class="form-control" name="GraphicListen" id="GraphicListen">
              </div>
            </div>

            <div class="form-group row">
              <div class="col-md-12">
                <div class="custom-control custom-checkbox">
                  <input id="autostart" name="Autostart" value="true" class="custom-control-input" type="checkbox"
                    {{ if .Vm.Autostart }}checked{{ end }} />
                  <label class="custom-control-label" for="autostart">Autostart</label>
                </div>
                <div class="custom-control custom-checkbox">
                  <input id="guestagent" name="GuestAgent" value="true" class="custom-control-input" type="checkbox"
                    {{ if .Vm.GuestAgent }}checked{{ end }} />
                  <label class="custom-control-label" for="guestagent">Guest Agent</label>
                </div>
                <div class="custom-control custom-checkbox">
                  <input id="Hugepages" name="Hugepages" value="true" class="custom-control-input" type="checkbox"
                    {{ if .Vm.Hugepages }}checked{{ end }} />
                  <label class="custom-control-label" for="Hugepages">Hugepages</label>
                </div>
              </div>
            </div>

            <div class="form-group row">
              <div class="col-md-12">
                <button class="btn btn-primary" data-loading="<i class='icon-refresh icons'></i> Updating..."
                  type="submit">Update</button>
              </div>
            </div>
          </form>

        </div>
      </div>
    </div>
  </div>
</div>
</div>


{{ template "footer" . }}
